//@author A0105740R

package rightnow.parser.cmdline;

/**
 * This class stores messages that are used by command parsers.
 */
final class CmdParserErrorMsg {
	// The following messages are used by CommandParser
	public static final String ERROR_NUM_ARG =
			"The number of arguments for command '%1s' is incorrect.";

	public static final String ERROR_FORMAT_INDEX =
			"The index number should be an integer.";
	public static final String ERROR_FORMAT_PAGE_NUM =
			"The page number should be an integer.";
	
	public static final String ERROR_EMPTY_COMMAND =
			"Please input a command.";
	
	// The following messages are used by CmdTypeParser
	public static final String ERROR_INVALID_COMMAND =
			"'%s' is not a valid command.";
	
	// The following messages are used by CmdDelParser
	public static final String ERROR_FORMAT_DEL =
			"The argument should either be 'done' or an index number.";
	
	// The following messages are used by CmdTaskParser
	public static final String ERROR_MISSING_CLOSE_QUOTE = 
			"Your closing \" is missing!";
	public static final String ERROR_EMPTY_TASK_TITLE =
			"The task description should not be empty.";
	public static final String ERROR_INVALID_NUM_IDTF =
			"You are using too many keywords!";
	public static final String ERROR_INVALID_NUM_DATES = 
			"You have too many dates!";
	public static final String ERROR_INVALID_POSITION_DATES = 
			"Please check the command format.";
	public static final String ERROR_DATE_PARSING = 
			"This date does not exist!";
	public static final String ERROR_IDTF_NOT_AT_BACK = 
			"Please check the command format.";
	public static final String ERROR_INVALID_START_END_DATETIME = 
			"The task start time should not exceed its end time.";
	public static final String ERROR_EXTRA_TEXT = 
			"The task description should be fully bounded by \"\".";
	public static final String ERROR_START_IDTF_AFTER_END_IDTF = 
			"'at' and 'starting' should come before 'by'.";
	
	/**
	 * Converts command type to its name.
	 * @param cmdType
	 * @return the name of the command
	 */
	public static String getCmdName(CommandType cmdType) {
		switch (cmdType) {
		case ADD:
			return "add";
		case ALL:
			return "all";
		case DELETE:
			return "delete";
		case DONE:
			return "done";
		case EDIT:
			return "edit";
		case NEXT:
			return "next";
		case NOW:
			return "now";
		case PAGE:
			return "page";
		case PIN:
			return "pin";
		case PREV:
			return "previous";
		case REDO:
			return "redo";
		case UNDO:
			return "undo";
		case UNDONE:
			return "undone";
		case UNPIN:
			return "unpin";
		default:
			return "";
		}
	}
}
